<layout name="../Common/Master/master" />
		<!--中间开始-->
<style>
	.list .postion dl dd a.green{
		color:lawngreen;
	}
</style>
		<div id="content">
			<div class="list">
				<div class="main">
					<div class="postion">
						<dl>
							<dt>品牌:</dt>
							<dd>
								<a <if condition="$_GET['bid'] eq 0">class="green"</if>  href="{:U('Home/search/searchs',['gname'=>$_GET['gname'],'bid'=>0])}">不限</a>
								<foreach name="brand" item="vo">
								    <a <if condition="$_GET['bid'] eq $vo['bid']">class="green"</if>  href="{:U('Home/search/searchs',['gname'=>$_GET['gname'],'bid'=>$vo['bid']])}">{$vo['bname']}</a>
								</foreach>
							</dd>
							<dl>
								<dt>排序:</dt>
								<dd>
									<a href="">默认</a>
									<a href="">价格</a>
								</dd>

							</dl>
							</dl>
					</div>

				</div>
			</div>

			<div class="listcontent">
				<div class="main">
					<ul>
						<foreach name="goods" item="vo">
						<li>
							<div class="listdesc">
								<dl class="desc">
									<a href="{:U('home/goodinfo/index',['gid'=>$vo['gid']])}" class="pro_list">
										<dt class="pic"><img width="170px" height="178.5px" class="lazy" src="{$vo['thumb']}"  alt="{$vo['gname']}"></dt>
										<dd class="cont">
											<span class="title">{$vo['gname']}</span>
											<span class="price">{$vo['price']}元</span>
										</dd>
									</a>
									<dd class="btns">
										<?php $gid=$vo['gid']?>
										<?php $pcid=$vo['pcid']?>
										<a href="javascript:;" onclick="addcart('{$gid}','{$pcid}')" class="add-cart" ><i></i><em>加入购物车</em></a>
									</dd>
								</dl>
							</div>
						</li>
						</foreach>
					</ul>
				</div>
			</div>
		</div>
		</div>
		<!--中间结束-->
<script>
	function addcart(gid,pcid){
		$.post("{:U('Home/list/addcart')}",{gid:gid},function(res){
            if(res.valid==0){
//                表示该用户没有登录
//              alert(res.msg);
				layer.msg('请先登录', {
					time: 0 //不自动关闭
					,btn: ['登录', '继续逛逛']
					,yes: function(index){
						location.href="__ROOT__/index.php/Home/lg/login/gid/"+gid;
					}
					,no:function(){
						history.back();
					}
				});
			}else{
				location.href="__ROOT__/Home/car/addcar/gid/"+gid+'/pcid/'+pcid;
			}
		},'json');
	}
</script>
